<template>
  <el-dialog
    title="确认"
    class="confirmSecondary"
    :visible.sync="isShowModel"
    :close-on-click-modal="false"
    @close="$emit('update:isShowDetail', false)"
    append-to-body>
    <div class="secondaryFlexCenter">
      <p>企业名称:&nbsp;&nbsp;{{dataInfo.enterpriseName}}</p>
      <p v-if="type === 0">本次发放额度:&nbsp;&nbsp;{{dataInfo.credit ? formatMoney.twoDecimal(dataInfo.credit) : '0.00'}}&nbsp;元</p>
      <p v-if="type === 2">本次发放额度:&nbsp;&nbsp;{{dataInfo.grantCredit ? formatMoney.twoDecimal(dataInfo.grantCredit) : '0.00'}}&nbsp;元</p>
      <p v-if="type === 1">本次发放临时额度:&nbsp;&nbsp;{{dataInfo.grantCredit ? formatMoney.twoDecimal(dataInfo.grantCredit) : '0.00'}}&nbsp;元</p>
      <p v-if="type === 2 || type === 0">账期:&nbsp;&nbsp;{{dataInfo.count}}个月</p>
      <p class="tipMessage">核实上述信息，确认后将不可撤回。</p>
    </div>
    <div slot="footer" class="dialog-footer">
      <el-button @click="isShowModel = false">取 消</el-button>
      <el-button type="primary" @click="$emit('confirmAmout')">确认</el-button>
    </div>
  </el-dialog>
</template>

<script>
  import formatMoney from '@/assets/js/formatMoney'
    export default {
        name: "SecondaryConfirm",
        props: {
          isShowDetail: {
            type: Boolean,
            default: false
          },
          dataInfo: {
            type: Object,
            default: () => {}
          },
          type: {
            type: Number,
            default: 0
          }
        },
        data() {
          return {
            isShowModel: this.isShowDetail,
            formatMoney: formatMoney
          }
        },
        watch: {
          isShowDetail(val) {
            this.isShowModel = val
          }
        }
    }
</script>

<style lang="scss">
.confirmSecondary {
  .el-dialog {
    width: 400px;
    font-size: 14px;
    .secondaryFlexCenter {
      margin: 0 auto;
      width: 260px;
    }
    .tipMessage {
      color: #199ED8;
    }
  }
}
</style>
